<?php

class AdminController extends BaseController {

	/*
	|--------------------------------------------------------------------------
	| Default admin Controller
	|--------------------------------------------------------------------------
	|
	| this is for the admin session index page will be the controller of layout and defacult value.
	|
	*/


    /**
     * The layout that should be used for responses.
     */
    protected $layout = 'layouts.admin';
	const GLOBAL_MESSAGE = 'global';

	public function index()
	{
		$this->layout->content = View::make('admin.index');
	}


	public function getUser()
	{

		$users=User::all();

		$data = ['users'=>$users] ; 

		$this->layout->content = View::make('admin.user',$data);
	}

	public function getNetwork()
	{

	   $networks = DB::table('network')->get();
       
       
        $data = ['network'=>$networks] ; 

		$this->layout->content = View::make('admin.network',$data);
	}



	public function getUserdelete($user_id)
	{

	 	$user = User::find($user_id);
	 	if($user){
			$user->delete();
			 return Redirect::route('admin/user')->with(self::GLOBAL_MESSAGE,trans('messages.UserDeleteSuccesss'));;	
	 	}
       		else{
        return Redirect::route('admin/user')->with(self::GLOBAL_MESSAGE,trans('messages.CannotDeleteUser'));;	
		}
	}

	public function getUserblock($user_id)
	{

	  return "user_Block".$user_id;
	}

	




}